﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.Common;

namespace Library.Entity
{
    public class Book : IdCodeName
    {
        public int BookShelfId = 0;
        public int BookCategoryId = 0;
        public string Barcode = "";
        public string Author = "";
        public string Publisher = "";
        public string DDC = "";
        public string ISBN = "";

        public object Tag;
        public Book()
        {
        }
        public Book(DbDataReader dr)
        {
            Id = DataConversion.ConvertToInt32(dr, "Id");
            Code = DataConversion.ConvertToString(dr, "Code");
            Name = DataConversion.ConvertToString(dr, "Name");
            Remark = DataConversion.ConvertToString(dr, "Remark");
            CreatedDate = DataConversion.ConvertToDateTime(dr, "CreatedDate");
            ModifiedDate = DataConversion.ConvertToDateTime(dr, "ModifiedDate");
            CreatedUserId = DataConversion.ConvertToInt32(dr, "CreatedUserId");
            ModifiedUserId = DataConversion.ConvertToInt32(dr, "ModifiedUserId");
            
            BookShelfId = DataConversion.ConvertToInt32(dr, "BookShelfId");
            BookCategoryId = DataConversion.ConvertToInt32(dr, "BookCategoryId");
            Barcode = DataConversion.ConvertToString(dr, "Barcode");
            Author = DataConversion.ConvertToString(dr, "Author");
            Publisher = DataConversion.ConvertToString(dr, "Publisher");
            DDC = DataConversion.ConvertToString(dr, "DDC");
            ISBN = DataConversion.ConvertToString(dr, "ISBN");
        }
    }
}